/*********************************************************
          File Name:varg.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 12 Sep 2015 11:53:37 AM CST
**********************************************************/

#include <iostream>
#include <string>
#include <initializer_list>
using namespace std;

int p(initializer_list<int> input)
{
        int res = 0;
        for(auto i: input)
        {
                res += i;
        }
        return res;
}

void p(initializer_list<string> s)
{
        auto it = s.begin();
        while(it != s.end())
        {
                cout << *it << " ";
                ++it;
        }
        cout << endl;
}


int main()
{
        initializer_list<int> tmp = {1, 2, 3, 4, 5, 6};
        initializer_list<string> s = {"this", "is", "a", "test"};
        int res =  p(tmp);
        cout << res << endl;

        p(s);
}
